import Cock from '../base/cock'
import tpl from './view/class.tmpl'
import data from './data/class_cn'
import cnLang from './lang/cn'

var i, x, tmp = {},
  auto = {
    name: 'class',
    tpl: tpl,
    data: data,
    tip: '请选择职位',
    //multi: 1,
    ratio: 12,
    parent: false, // 这是父级可选
    mui: {},
  }, key;

auto.data.lang = cnLang;


auto.data.type = {};
auto.data.all = [];
for (i = 0; i < auto.data.a_ll.length; i++) {
  key = auto.data.a_ll[i];
  auto.data.type[key] = auto.data.raw[key];
  tmp[key] = i;
  auto.data.all.push([key, []]);
}


for (i in auto.data.raw) {
  key = i.match(/\d{2}/) + '00';
  if (!/0{2}$/.test(i)) {
    auto.data.all[tmp[key]][1].push(i);
  }
}



// console.log(auto);


function Class(option, callback) {
  Cock.run($.extend({}, auto, option), callback);
}


Class.skin = Cock.skin;
Class.data = auto.data;

export default Class;
